---
# id: anthropic
title: Anthropic
sidebar_label: Anthropic
---

DeepEval supports using any Anthropic model for all evaluation metrics. To get started, you'll need to set up your Anthropic API key.

### Setting Up Your API Key

To use Anthropic for `deepeval`'s LLM-based evaluations (metrics evaluated using an LLM), provide your `ANTHROPIC_API_KEY` in the CLI:

```bash
export ANTHROPIC_API_KEY=<your-anthropic-api-key>
```

Alternatively, if you're working in a notebook environment (e.g., Jupyter or Colab), set your `ANTHROPIC_API_KEY` in a cell:

```bash
%env ANTHROPIC_API_KEY=<your-anthropic-api-key>
```

### Python

To use Anthropic models for DeepEval metrics, define an `AnthropicModel` and specify the model you want to use. By default, the `model` is set to `claude-3-7-sonnet-latest`.

```python
from deepeval.models import AnthropicModel
from deepeval.metrics import AnswerRelevancyMetric

model = AnthropicModel(
    model="claude-3-7-sonnet-latest",
    temperature=0
)
answer_relevancy = AnswerRelevancyMetric(model=model)
```

There are **TWO** optional parameters when creating an `AnthropicModel`:

- [Optional] `model`: A string specifying which of Anthropic's Claude models to use. Defaulted to `'claude-3-7-sonnet-latest'`.
- [Optional] `temperature`: A float specifying the model temperature. Defaulted to 0.
- [Optional] `generation_kwargs`: A dictionary of additional generation parameters supported by your model provider.

:::tip
Any `**kwargs` you would like to use for your model can be passed through the `generation_kwargs` parameter. However, we request you to double check the params supported by the model and your model provider in their [official docs](https://docs.anthropic.com/en/docs/about-claude/models/overview).
:::

### Available Anthropic Models

:::note
This list only displays some of the available models. For a comprehensive list, refer to the Anthropic's official documentation.
:::

Below is a list of commonly used Anthropic models:

- `claude-3-7-sonnet-latest`
- `claude-3-5-haiku-latest`
- `claude-3-5-sonnet-latest`
- `claude-3-opus-latest`
- `claude-3-sonnet-20240229`
- `claude-3-haiku-20240307`
- `claude-instant-1.2`
